cmake_minimum_required(VERSION 3.23)
project(vin_test)

set(CMAKE_CXX_STANDARD 14)

find_package(OpenCV REQUIRED)
find_package(Eigen3)
find_package(Ceres REQUIRED)
find_package(catkin REQUIRED COMPONENTS
        roscpp
        rospy
        image_transport
        cv_bridge
        std_msgs
        )
find_package(Boost REQUIRED COMPONENTS filesystem program_options system)

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

include_directories(
        ${PROJECT_SOURCE_DIR}
        ${PROJECT_SOURCE_DIR}/include
        ${PROJECT_SOURCE_DIR}/include/camera_model/camera_models
        ${PROJECT_SOURCE_DIR}/include/camera_model/calib
        ${PROJECT_SOURCE_DIR}/include/camera_model/gpl
        ${PROJECT_SOURCE_DIR}/include/camera_model/chessboard
        ${PROJECT_SOURCE_DIR}/include/camera_model/sparse_graph
        ${OpenCV_INCLUDE_DIRS}
        ${EIGEN3_INCLUDE_DIR}
        ${catkin_INCLUDE_DIRS}
        ${Boost_INCLUDE_DIRS}
        ${CERES_INCLUDE_DIRS}
)

add_library(${PROJECT_NAME} SHARED
        src/feature_tracker.cpp
        src/Parameters.cpp
        src/visualInertialOdometry.cpp
        src/camera_model/intrinsic_calib.cc
        src/camera_model/calib/CameraCalibration.cc
        src/camera_model/camera_models/Camera.cc
        src/camera_model/camera_models/CameraFactory.cc
        src/camera_model/camera_models/CataCamera.cc
        src/camera_model/camera_models/CostFunctionFactory.cc
        src/camera_model/camera_models/EquidistantCamera.cc
        src/camera_model/camera_models/PinholeCamera.cc
        src/camera_model/camera_models/ScaramuzzaCamera.cc
        src/camera_model/chessboard/Chessboard.cc
        src/camera_model/gpl/EigenQuaternionParameterization.cc
        src/camera_model/gpl/gpl.cc
        src/camera_model/sparse_graph/Transform.cc
        src/Estimator.cpp include/Estimator.h include/util/IntegrationBase.h include/util/utility.h)

add_executable(system system.cpp)
target_link_libraries(system
        ${PROJECT_NAME}
        ${OpenCV_LIBS}
        ${catkin_LIBRARIES}
        ${Boost_LIBRARIES}
        ${CERES_LIBRARIES}
)
